/**
 * Project: complex.java
 * 
 * File Created at 2010-4-12
 * $Id$
 * 
 * Copyright 2008 Alibaba.com Croporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package complex.java.digester;

import java.io.File;
import java.io.IOException;
import java.util.Date;

import org.apache.commons.digester.Digester;
import org.xml.sax.SAXException;

/**
 * @description:XXX
 * @author gaoliang
 * @date 2010-4-12
 * @version 1.0
 */
public class DigesterTest {
    
    public static void main(String[] args) {
        try {
        Date dateStar = new Date();
        Digester digester = new Digester();
        digester.setValidating(false);
        digester.addObjectCreate("areas/area", AreaXml.class);
        digester.addBeanPropertySetter("areas/area/id");
        digester.addBeanPropertySetter("areas/area/parentId");
        digester.addBeanPropertySetter("areas/area/areaType");
        digester.addBeanPropertySetter("areas/area/name");
        digester.addBeanPropertySetter("areas/area/ordering");
        digester.addBeanPropertySetter("areas/area/phoneArea");
      
        digester.addCallMethod("areas/area", "setA");
        File file = new File("d:/test.xml");
            digester.parse(file);
            System.out.println("count"+AreaXml.count);
            Date end = new Date();
            System.out.print(end.getTime()-dateStar.getTime());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SAXException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
   
}
